package com.smart.business.service;

import com.baomidou.mybatisplus.extension.toolkit.Db;
import com.smart.business.dao.ParamDao;
import com.smart.entity.business.ParamEntity;
import com.smart.mybatis.service.impl.BaseServiceImpl;
import com.smart.business.dao.ParameterTemplateDao;
import com.smart.entity.business.ParameterTemplateEntity;
import com.smart.service.business.ParameterTemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Collections;
import java.util.List;

/**
 * 参数模板 ServiceImpl
 *
 * @author wf
 * @since 2025-07-15 13:03:48
 */
@Service("parameterTemplateService")
@Transactional(rollbackFor = Exception.class)
public class ParameterTemplateServiceImpl extends BaseServiceImpl<ParameterTemplateDao, ParameterTemplateEntity> implements ParameterTemplateService {
    @Autowired
    private ParamDao paramDao;
    @Override
    public List<ParamEntity> templateParam(String templateId) {
        //获取参数模板信息
        return paramDao.templateParam(templateId);
    }

    @Override
    public boolean addParam(ParamEntity paramEntity) {
        return paramDao.insert(paramEntity);
    }

    @Override
    public boolean deleteParam(String id) {
        return paramDao.delete(id);
    }

    @Override
    public List<ParameterTemplateEntity> templateList(String meterTypeId) {
        return paramDao.templateListByMeterTypeId(meterTypeId);
    }
}